package com.atguigu.bean;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

/*
{
          "title" : "小米手机",
          "images" : "http://image.jd.com/12479122.jpg",
          "price" : 2899,
          "stock" : 200,
          "saleable" : true,
          "attr" : {
            "category" : "手机",
            "brand" : "小米"
          }
        }
      }
 */
@Data
@Document(indexName = "atguigu")
public class Goods {
    @Id
    String id;
    @Field(name = "title",type = FieldType.Text
        ,analyzer = "ik_max_word")
    String title;
    @Field(name = "price",type = FieldType.Double
           )
    Double price;
    @Field(name = "stock",type = FieldType.Integer)
    Integer stock;
    @Field(name = "saleable",type = FieldType.Boolean)
    Boolean saleable;
    @Field(name = "attr",type = FieldType.Object)
    Attr attr;
}
